1. Field of the Invention
The present invention relates to a gray scaled data generation device for generating gray scaled data from outline data, such as characters and graphics.
2. Description of the Related Art
It has become increasingly important in recent years to provide information processing devices, such as personal computers, electric notebooks, portable information apparatuses, and game consoles, with a character display function for setting character size, typeface, character decoration and the like.
In general, computer displays have lower resolutions than printers This difference in resolution means that binary data of black and white cannot be shown on a display at the same high quality as is possible with a printed output. When using a display, this results in the outlines of characters and images being jagged and an inability to display very precise images on such display equipment. Here, on display equipment which is capable of displaying black, white and intermediate tones (shades of gray), the detrimental effects of low resolution can be somewhat compensated by using black, white and gray pixels, resulting in an improvement in image quality. Such gray scaled data represented by black, white or intermediate tones can be generated using a common technique known in the field of computer graphics as antialiasing.
Conventional methods generate gray scaled data by first generating a black and white binary image from outline information which includes the outline data for characters and images, said image which corresponds to a number of pixels for a desired size here being enlarged in the horizontal and vertical planes by a integer multiplier. The shade of each pixel is then set according to the number of black subpixels included in a given unit area of the generated binary image (one pixel multiplied by an integer).
FIG. 3 is a function block diagram showing the construction of a conventional gray scaled date generation device. It is composed of outline information expansion/reduction unit 201 and gray scaled data generation unit 202. Gray scaled data generation unit 202 is further made up of binary data generation unit 301 and gradation value calculation unit 302.
The following is an explanation with reference to FIGS. 3 through 11A-11C of the operation of the conventional gray scaled data generation method and device constituted as described above.
FIGS. 4 and 5A and 5B are examples of outline information and stroke position information included in outline data of a character and image. In this example, the Chinese character "" "SAN" meaning "three" is expressed by a set of lines in a 1,000 by 1,000 coordinate system (which is hereinafter referred to as 1,000 mesh). In this example, the outline information is composed of three outlines and is expressed by the coordinated of the corner points of each outline. By joining the point indicated by these coordinates, the outlines for each line constituting the character can be displayed In this example, the last coordinate point is automatically joined with the starting coordinate point. It should be noted here that such Chinese characters often feature secondary curved lines and tertiary curved lines in addition to straight lines.
The position information of the three horizontal strokes (called "horizontal stems" in the case of a character) is stored as stroke position information. In this example, a pair of Y coordinate values of a lower line and an upper line of a horizontal stroke is stored. The width of a horizontal stroke can be obtained by subtracting the Y coordinate value of the lower line from that of the upper line. In this example, the width of each horizontal stroke is 100. It is possible here for information to be stored in other ways, such as storing a Y coordinate value of the lower line and stroke width as horizontal stroke information, and adding them to the outline information as attributes of coordinates. If vertical strokes exist, vertical stroke information is stored in the same way. This stroke position information is generally referred to as hint information, which is used to keep the width of the stroke consistent after expansion/reduction.
The following is an explanation of the generation of gray scaled data composed of 10 by 10 pixels for one character (10 by 10 making a total of 100 pixels) using the outline data.
Outline information expansion/reduction unit 201 expands/reduces outline data, enlarging the number of pixels of the desired size in the horizontal and vertical planes by a integer multiplier. In this example, the desired size is 10 by 10 pixels, If the multiplier rate is set to 8 in each axes, outline information of the outline data of 1,000 mesh is reduced to that of 80 (10*8) mesh. It should be clear here that other multipliers may be used.
The reason integer multiplication is used is explained as follows. When the desired size is 10 by 10 pixels, outline information of the outline data of 1,000 mesh is reduced to 10 mesh. However, in order to generate gray scaled data, a gradation value of each pixel has to be decided. Accordingly, each pixel is divided and the proportion of the black component part of the pixel is obtained, with the gradation level then being decided according to this proportion. As one example, if each side of a pixel is divided by eight, one pixel can be divided into 64 small pixels. Here, the mesh which divides one pixel is referred to as a "submesh", a divided small pixel in referred to as a "subpixel", a border between pixels is referred to as a "pixel border", a border between subpixels is referred to as a "subpixel border", a point of intersection of subpixel borders is referred to as a "grid" (the four corners of each pixel), and a point of intersection of subpixel borders is referred to as a "subgrid" (the four corners of each subpixel). In FIG. 6, pixels are shown divided into subpixels with thick lines representing pixel borders and thin lines representing subpixel borders. In this example, one side of a pixel is divided into 8, so that each pixel is divided into 64 subpixels. Expanding/reducing outline data by subdividing pixels in a character of the desired size by 8 in both axes corresponds to transforming the outline date into a coordinate system represented by submeshes (subpixels). In this example, 1,000 mesh data is reduced to 80 submesh (10 mesh) data.
FIG. 7 shows outline information of outline data reduced to 80 submesh. If a simple reduction is carried out, the width of the three horizontal strokes in the character "" "SAN" may not be equal due to quantization error. However in this example, stroke width is kept equal due to the execution of what is called "hint processing", which uses stroke position information to keep the stroke width consistent In this example, the width of the three strokes are all 100 in 1,000 mesh, before reduction to eight in the 80 subminsh (eight subpixel width) which is determined by 100*80/1000=8. It should be noted here that hint processing is widely used to improve quality when binary data is generated from an outline font. Without hint processing, stroke width becomes inconsistent, thereby spoiling the appearance of the displayed character.
Binary data generation unit 301 generates binary image data from the outline information of the outline data which is expanded/reduced by outline information expansion/reduction unit 201. FIG. 8 shows binary data of 80 by 80 subpixels generated from outline information of the reduced outline data in FIG. 7.
Gradation value calculation unit 302 generates gray scaled image data, calculating gradation value of each pixel from the binary data generated by binary data generation unit 301. If one pixel is divided by eight in each axis, one pixel of the final gray scaled image data is represented by 64 subpixels. Gradation value calculation unit 302 calculates a gradation value for one pixel of the final gray scaled image data based on the number out of the 64 subpixels which are black, using this as the final gradation value of that pixel. In case of generating gray scaled image data of eight shades, a gradation value is calculated by dividing the number of black subpixels in one pixel by eight, corresponding to gradation values from 0-7 (if the number of black subpixel is 64, gradation value is still set at 7). Gradation value 0 represents white, gradation values 1-6 represent middle tones (the greater the value, the darker the shade), and gradation value 7 represents black. FIG. 9 shows gray scaled image data generated by binary data of 80 by 80 subpixels in FIG. 8.
In the conventional art, even if there is consistency in width of horizontal/vertical strokes in outline information of the outline data after expansion/reduction, their appearance on display differs depending on the position of the strokes, which can spoil the appearance of the character.
In FIGS. 7 and 8, the three horizontal strokes are of equal width at 8 subpixels. However, the positions of the three horizontal strokes inside pixels ore different from each other. In FIGS. 10A, 10B, and 10C an enlargement of how three horizontal strokes are positioned is shown, with left portion representing the top stroke (horizontal stroke 3), the middle portion representing the middle stroke (horizontal stroke 2); and the right portion representing the bottom stroke (horizontal stroke 1) The upper line of the top stroke is on the seventh subpixel border from the top (so that the stroke only fills 1/8 of the pixel), the upper line of the middle stroke is on the fourth subpixel border from the top (so that the stroke fills half the pixel); and the upper line of the bottom stroke falls exactly on the pixel border (so that the stroke fills the pixel). FIGS. 11A, 11B, and 11C are grey scaled data corresponding to the three strokes in FIGS. 10A, 10B, and 10C.
In the right portion, horizontal stroke 1 is too clearly drawn and so looks thin on display. Since there are no middle tones, the presence of other strokes such as curved lines or slanting lines will result in inconsistency between the thickness of lines. In the middle portion, horizontal stroke 2 looks too faint and wide on display, as if blurred. As shown in this figure, strokes positioned differently on the submeshes end up being displayed using different gradation tones. Therefore the three strokes look different in the gray scaled data in FIG. 9 resulting in inconsistent stroke width on a low-resolution display or liquid crystal panel. When there are two strokes of different widths in the data, there have even been cases with conventional techniques whereby the stroke which should look thicker looks thinner than the other on the display. If hint processing is not carried out to keep stroke width consistent, there can be further deterioration in the shape of the character on the display.
This example has focused on binary data in which one pixel is divided into 64 subpixels (8 by 8submesh). It is also possible for the pixel to be divided into 256 subpixels (16 by 16 submesh) so that more accurate grey scaled data can be generated. However, this does not solve the above mentioned problems.